<?php
class MY_Model extends CI_Model{	
	function view(){
		$this->db->order_by('id', 'desc');
		$query		= $this->db->get_where($GLOBALS['table']);
		return $query->result_array();
	}

	function save(){
		$this->db->insert($GLOBALS['table'], $this);
		return $this->db->insert_id();
	}

	function update(){
		$this->db->where('id', $this->id);
		$this->db->update($GLOBALS['table'], $this);
	}

	function delete(){
		$this->db->where('id', $this->id);
		$this->db->delete($GLOBALS['table']);
	}
}